<!-- Create a header in the default WordPress 'wrap' container -->
<div class="wrap">
    <div id="icon-plugins" class="icon32"></div>
    <h2>WP cr mobile</h2>

    <form method="post" action="<?php echo $formUrl ?>">
        <input type="hidden" name="id" id="id" value="<?php echo $id ?>"/>
        <?php
        wp_nonce_field('mod_wp_crmobile _man', 'mod_wp_crmobile _man_nonce');
        ?>

        <p class="submit">

        Review Threshold: <select id="threshold" name="threshold">
            <?php
            $thresholds = array(0,1,2,3,4,5);
            foreach ($thresholds as $value) { ?>

            <option value="<?php echo $value ?>"<?php
            if ($threshold == $value) {
                echo ' selected';
            }
            ?>><?php echo $value; ?></option>
            <?php } ?>
        </select>
        <label for="threshold"> <?php _e('', 'wp-cr-mobile'); ?></label>

    <?php
        submit_button(__('Update Threshold', 'wp-cr-mobile'), 'secondary', 'submit', false);
    ?>
        </p>
    </form>


        <h2>Moderate Reviews</h2>

        <table class="wp-list-table widefat fixed posts">
            <tr>
                <th>Date</th>
                <th>Name</th>
                <th>E-Mail</th>
                <th>Review</th>
                <th>Rating</th>
                <th>Status</th>
                <th>Actions</th>
            </tr>
            <?php
            foreach ($reviews as $review) {
            $publish = add_query_arg(
                array_merge($queryArgs, array(
                    'action' => 'moderate',
                    'id' => $id,
                    'review' => $review['ID'],
                    'set' => 'published'
                )),
                $baseUrl
            );
            $unpublish = add_query_arg(
                array_merge($queryArgs, array(
                    'action' => 'moderate',
                    'id' => $id,
                    'review' => $review['ID'],
                    'set' => 'unpublished'
                )),
                $baseUrl
            );
            $delete = add_query_arg(
                array_merge($queryArgs, array(
                    'action' => 'moderate',
                    'id' => $id,
                    'delete' => $review['ID']
                )),
                $baseUrl
            );
            ?>
            <tr>
                <td><?php echo date('M d, Y', strtotime($review['review_date'])); ?></td>
                <td><?php echo $review['reviewer_name']; ?></td>
                <td><?php
                    if ($exclude['email'] == true) {
                        echo 'n/a';
                    } else {
                        echo $review['reviewer_email'];
                    }
                ?></td>
                <td><?php echo stripslashes($review['review']); ?></td>
                <td><?php echo $review['rating']; ?></td>
                <td><?php echo ucfirst($review['status']); ?></td>
                <td>
                    <?php
                    if ($review['status'] == 'published') { ?>
                    <a href="<?php echo $unpublish; ?>" class="button">Unpublish</a>
                    <?php } else { ?>
                    <a href="<?php echo $publish; ?>" class="button">Publish</a>
                    <?php } ?>
                    <a href="<?php echo $delete; ?>" class="button">Delete</a>
                </td>
            </tr>
            <?php } ?>
        </table>

</div><!-- /.wrap -->
